<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
<script type="text/javascript" src="/oa/Public/js/jquery.js"></script>
<script type="text/javascript" src="/oa/Public/js/common.js"></script>
<link rel="stylesheet" type="text/css" href="/oa/Public/css/global.css" />
<link rel="stylesheet" type="text/css" href="/oa/Public/css/form.css" />
<script type="text/javascript" src="/oa/Public/uploadify/jquery.uploadify.min.js"></script>
<link rel="stylesheet" type="text/css" href="/oa/Public/uploadify/uploadify.css" />
</head>
<body>
<div class="search"><b><?php echo ($foldername); ?></b>
	<input type="button" value="返回列表" class="button" onclick="location='/oa/index.php/Database/upload_list?id=<?php echo ($id); ?>&type=<?php echo ($type); ?>'" >
</div>
<div class="container" style="margin-left:20px;">
    <div class="block">
        <div class="cnt-wp">
            <div class="cnt">
                <div class="search-bar">
                <form name="form1" id="form1" method="post" action="/oa/index.php/Home/Database/uploadfile" >
                    <input id="file_upload" name="file_upload" type="file" multiple="true">
                    <input type="hidden" name="id" value="<?php echo ($id); ?>" >
                    <input type="hidden" name="type" value="<?php echo ($type); ?>" >
                </form>
                </div>
                <div class="impBtn fLeft" id="input_file" style="display:none">
					<input id="start_upload" type="button" value="上传" class="button" />
				</div>
            </div>
        </div>
    </div>

</div>
</body>
</html>
<script language="javascript">
	<?php $timestamp = time();?>
	$(function() {
		$('#file_upload').uploadify({
			'debug'			: false,
			'formData'     	: {
				'timestamp' : '<?php echo $timestamp;?>',
				'token'     : '<?php echo md5('unique_salt' . $timestamp);?>'
			},
			'fileSizeLimit'  : '10MB',
			'fileTypeDesc'   : 'Check Files',
			'auto'           : false,
			'fileTypeExts'   : '*.xlsx;*.xls;*.csv;*.ppt;*.pdf;*.doc;*.docx;*.txt;',
			'queueSizeLimit' : 10,
			'swf'      : '/oa/Public/uploadify/uploadify.swf',
			'uploader' : '/oa/index.php/Home/Database/uploadfile?id=<?php echo ($id); ?>&type=<?php echo ($type); ?>',//返回一个错误，选择文件的时候触发
	        'onSelectError':function(file, errorCode, errorMsg){
	            switch(errorCode) {
	                case -100:
	                    alert("上传的文件数量已经超出系统限制的"+$('#file_upload').uploadify('settings','queueSizeLimit')+"个文件！");
	                    break;
	                case -110:
	                    alert("文件 ["+file.name+"] 大小超出系统限制的"+$('#file_upload').uploadify('settings','fileSizeLimit')+"大小！");
	                    break;
	                case -120:
	                    alert("文件 ["+file.name+"] 大小异常！");
	                    break;
	                case -130:
	                    alert("文件 ["+file.name+"] 类型不正确！");
	                    break;
	            }
	        },
	        'onCancel'       : function(){
	        	$("#input_file").css('display','none');
	        },
	        'onDialogClose'  : function(filesSelected){
		       	if(filesSelected.filesQueued == 1 && filesSelected.filesErrored == 0)
		       	{
		       		$("#input_file").css('display','');
		       	}	 
	        },
	        'onUploadStart'  : function(){
	       	 $("#input_file").css('display','none');	
	        },
	        //检测FLASH失败调用
	        'onFallback':function(){
	            alert("您未安装FLASH控件，无法上传图片！请安装FLASH控件后再试。");
	        },
	        //上传到服务器，服务器返回相应信息到data里
	        'onUploadSuccess':function(file, data, response){
	            alert(data);
	        }
		});
		
		$("#start_upload").click(function(){
			$("#file_upload").uploadify('upload');
		});
		
		$(".stripe tr").mouseover(function(){    
			  $(this).addClass("over");}).mouseout(function(){   
					$(this).removeClass("over");}) 
		$(".stripe tr:even").addClass("alt");
	});
	
</script>